<!--
 * @Author: asushiye
 * @Date: 2020-07-02 15:30:23
 * @Commit: file content
-->
<page-header autoTitle="false" />

<nz-card>
  <form nz-form nzLayout="inline" se-container>
    <se label="术语" labelWidth="0">
      <input nz-input name="termCn" placeholder="请输入术语, 支持模糊查询" [(ngModel)]="queryParams.termCn" />
    </se>
    <se label="英文" labelWidth="0">
      <input nz-input name="termEn" placeholder="请输入英文, 支持模糊查询" [(ngModel)]="queryParams.termEn" />
    </se>
    <se label="类型" labelWidth="0">
      <input nz-input name="termType" placeholder="请输入类型, 支持模糊查询" [(ngModel)]="queryParams.termType" />
    </se>
    <se>
      <button nz-button nzType="primary" (click)="query()" [nzLoading]="isLoading">查询</button>
      <button nz-button [nzType]="'default'" (click)="add()">
        <i nz-icon nzType="plus-circle"></i>
        <span>新建</span>
      </button>
    </se>
  </form>
  <st #st [data]="url" [req]="req" [columns]="columns" [expand]="expand" [ps]="200" size="small" expandRowByClick expandAccordion>
    <ng-template #expand let-item let-index="index" let-column="column">
      <sv-container size="small" col="3">
        <sv-title>更多内容</sv-title>
        <sv label="备注" col="3">{{ item!.termRemark }}</sv>
        <sv label="设计人" type="success">{{ item.termDesigner }}</sv>
        <sv label="创建人">{{ item!.createdBy }}</sv>
        <sv label="创建时间">{{ item!.createdDate }}</sv>
      </sv-container>
    </ng-template>
  </st>
</nz-card>

<nz-drawer
  [nzSize]="drawerOption.size"
  [nzVisible]="drawerOption.visible"
  [nzTitle]="drawerOption.title"
  nzPlacement="right"
  [nzFooter]="drawerTemplate"
  (nzOnClose)="closeDrawer()"
>
  <ng-container *nzDrawerContent>
    <form nz-form [nzAutoTips]="autoTips" [formGroup]="tForm">
      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="termCn" nzRequired>术语</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="Please input your termCn">
          <input formControlName="termCn" nz-input placeholder="" />
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="termCnDesc">术语描述</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="Please input your termCnDesc">
          <input formControlName="termCnDesc" nz-input placeholder="" />
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="termEn" nzRequired>英文</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="Please input your termEn">
          <input formControlName="termEn" nz-input placeholder="" />
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="termEnDesc">英文全称</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="Please input your termEnDesc">
          <input formControlName="termEnDesc" nz-input placeholder="" />
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="termType">术语类型</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="Please input your termType">
          <input formControlName="termType" nz-input placeholder="" />
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="termRemark">备注</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="Please input your termRemark">
          <textarea formControlName="termRemark" nz-input placeholder=""></textarea>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" nzFor="termDesigner">设计人</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="Please input your termDesigner">
          <input formControlName="termDesigner" nz-input placeholder="" />
        </nz-form-control>
      </nz-form-item>
    </form>
  </ng-container>
</nz-drawer>

<ng-template #drawerTemplate>
  <button nz-button nzType="primary" (click)="save()" [nzLoading]="isLoading" [disabled]="tForm.invalid">
    <i nz-icon nzType="save"></i> 保存</button
  >
  <button style="float: right" nz-button nzType="default" (click)="closeDrawer()">关闭</button>
</ng-template>
